
package Entity;

import java.util.List;
import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author JuanFelipe
 */
public class TableModelProfile extends ListDataModel<Profile> 
                            implements SelectableDataModel<Profile> {

    public TableModelProfile() {
    }

    public TableModelProfile(List<Profile> list) {
        super(list);
    }
    
    @Override
    public Profile getRowData( String rowKey ){
        List<Profile> profiles = ( List<Profile> )getWrappedData();
        
        for( Profile p : profiles ){
            if( p.getProfile().equals(rowKey) )
                return p;
        }
        
        return null;
    }
    
    @Override
    public Object getRowKey( Profile profile ){
        return profile.getProfile();
    }
    
}
